package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Report;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ReportMapper {

    @Select("SELECT category.`name` as 'name', sum(order_detail.number) as 'value' FROM order_detail " +
            "INNER JOIN dish ON order_detail.dish_id = dish.id INNER JOIN category ON  dish.category_id = category.id " +
            "GROUP BY category.`name`")
    List<Report> getReport();
}
